package com.apes.auto.car.service;

import com.apes.auto.car.model.CarThumbnail;
import com.apes.auto.car.repository.CarThumbnailRepository;
import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName CarThumbnailService
 * @Description TODO
 * @Author pengyb
 * @Date 2019/7/31 17:10
 * @Version 1.0
 **/
@Service("carThumbnailService")
public class CarThumbnailService extends DomainService {
    @Autowired
    private CarThumbnailRepository carThumbnailRepository;

    public CarThumbnail save(SimpleRequest request) {
        CarThumbnail o = request.getO(CarThumbnail.class);
        return carThumbnailRepository.saveAndFlush(o);
    }

    public String delete(SimpleRequest request) {
        CarThumbnail o = request.getO(CarThumbnail.class);
        carThumbnailRepository.delete(o.getId());
        return "删除成功";
    }
}
